#!/usr/bin/env python
__author__ = "Ingmar Krusch"
__email__ = "krusch@immobilienscout24.de"
from optparse import OptionParser

class Config:
	"""Consume configuration options from command line args"""

	def __init__(self):
		self.collapseDuplicates = False
		self.remainingArgs = []

	def readCommandLineArguments(self, argv):
		parser = OptionParser()
		parser.add_option("-c", "--collapseDuplicates", action="store_true", dest="collapseDuplicates", default=False,
						  help="if true, the last given versionSpec for a package wins")
		parser.add_option("--negative", action="store_false", dest="positiveFilter", default=True,
						help="if true the filter will be applied negatively")
		parser.add_option("-f", "--filter", dest="filterRegex", default=".*", help="regular expression to apply to package names. [Default %default]")

		(options, self.remainingArgs) = parser.parse_args(argv)
		self.collapseDuplicates = options.collapseDuplicates
		self.filterRegex = options.filterRegex
		self.positiveFilter = options.positiveFilter

	def __repr__(self):
		return "collapseDuplicates:" + repr(self.collapseDuplicates) + ", " + "args:" + repr(self.remainingArgs)